package com.ljf.framework.result;


/**
 * @Auther: lijinfeng
 * @Date: 2021/12/7
 * @Description 描述:公用返回对象Result的枚举类型ResultEnum
 */
public enum JsonResultEnum {

    NULL(0,"无对应枚举"),

    //通用
    SUCCESS(200,"请求成功"),
    //认证
    UNAUTHORIZED(401, "未认证"),
    ERROR(500,"服务端异常"),
    OBJECT_NULL(600,"查询对象null"),

    //用户
    USER_NOT_EXIST(500200,"用户不存在"),
    USER_NOT_EXIST_ROLE(500201,"用户不存在角色"),
    USER_NOT_LOGGED_IN(500202,"用户未登陆"),
    USERNAME_OR_PASSWORD_ERROR(500203,"用户名密码错误"),
    USER_ABNORMAL(500200,"用户异常"),

    //token
    TOKEN_INVALID_OR_EXPIRED(500300, "token无效或已过期"),
    TOKEN_ACCESS_FORBIDDEN(500301, "token已被禁止访问"),
    TOKEN_EXPIRED(500302, "token已过期"),
    TOKEN_INVALID(500303,"token无效"),

    REFRESH_TOKEN_EXPIRED (500304,"refresh_token已过期"),

    TOKEN_SERVER_ERROR(500305, "token服务异常"),



    //权限
    ACCESS_UNAUTHORIZED(500400, "访问未授权"),


    //GRANT 授权
    INVALID_GRANT_REFRESH_TOKEN(500501, "无效的刷新令牌"),
    INVALID_GRANT_AUTHORIZATION_CODE(500502, "无效的授权码"),
    INVALID_GRANT(500503, "无效的授予"),
    OAUTH_EXCEPTION(500504, "未知OAUTH认证异常"),


    //client
    CLIENT_NOT_EXIST(500600,"client不存在"),
    CLIENT_AUTHENTICATION_FAILED(500601,"client认证失败"),


    //SQL
    SQL_VIOLATE_UNIQUE_INDEX(500700,"违反唯一索引"),

    // sentinel
    SENTINEL_GW_FLOW_LIMITING(500800,"限流了"),
    SENTINEL_FLOW_LIMITING(500801,"FLOW限流了"),

    // 重复提交
    REPEAT_SUBMIT(500900,"禁止重复提交"),

    // 验证码相关
    CAPTCHA_ERROR(501100,"验证码错误")

    ;

    @Override
    public String toString() {
        return "JsonResultEnum{" +
                "code=" + code +
                ", message='" + message + '\'' +
                '}';
    }

    JsonResultEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    private final Integer code;
    private final String message;


}
